let mongoose = require('./db')
const ObjectId = mongoose.Schema.Types.ObjectId


const FamilySchema = new mongoose.Schema({
  name: { type: String, index: true }, // 户主姓名
  user: { type: ObjectId, required: true, ref: 'User', unique: true }, // 户主
  desc: String, // 家庭困难说明
  tag: [{ type: ObjectId, ref: 'Tag' }], // 家庭分类
  creator: { type: ObjectId, required: true, ref: 'Admin' },
}, {
  collection: 'Family',
  timestamps: true
})

const Family = mongoose.model('Family', FamilySchema)

module.exports = Family